package com.yp.lession52.aop;
/**
 * 环绕增强  类似过滤器
 */

import org.aopalliance.intercept.Invocation;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class MyMethodIntercepter implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("环绕的前置增强");

        //要放行
        Object proceed = methodInvocation.proceed();
        //方法参数
        System.out.println(methodInvocation.getMethod().getName());
        //process 方法的返回值
        Object proceed1 = methodInvocation.proceed();


        System.out.println("环绕的后置增强");

        return proceed+" world";
    }
}
